const Service = require('egg').Service;

class AdminService extends Service {
  async index(){
		const user = this.app.mysql.get('article', { id: 1 });
		return user;
	 }
	 async list(){
	 		const list = this.app.mysql.select('article');
	 		return list;
	 }
	 async add(user){
	 		const status = this.app.mysql.insert('article',user); 
	 		return status;
	 }
	 async edit(data){
	 		const user = this.app.mysql.update('article', { id: data});
	 		return user;
	 }
	 async delete(id){
	 		const user = this.app.mysql.delete('article', { id: id });
	 		return user;
	 }
}

module.exports = AdminService
